<template>
    <download-excel
            class = "export-excel-wrapper"
            :fetch="fetchData"
            :fields = "jsonFields"
            :before-generate = "startDownload"
            :before-finish = "finishDownload"
            :name = "fillName">
        <!-- 上面可以自定义自己的样式，还可以引用其他组件button -->
        <el-button type="info"
                   icon="el-icon-download"
                   :size="this.size?this.size:'medium'">导出</el-button>
    </download-excel>
</template>

<script>
    import downloadExcel from 'vue-json-excel';
    export default {
        name: "ExcelModel",
        components:{downloadExcel},
        props:['fetchData','jsonFields','fillName','success','size'],
        data(){
            return {

            }
        },
        methods:{
            startDownload(){
                console.log('show loading');
            },
            finishDownload(){
                console.log('hide loading');
                this.success && this.success();
            }
        }
    }
</script>

<style scoped>

</style>